home *** CD-ROM | disk | FTP | other *** search
-
-
-
- aaaallllCCCCoooonnnnnnnneeeecccctttt((((3333ddddmmmm)))) aaaallllCCCCoooonnnnnnnneeeecccctttt((((3333ddddmmmm))))
-
-
-
- NNNNAAAAMMMMEEEE
- alConnect - connect two audio I/O resources
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////aaaauuuuddddiiiioooo....hhhh>>>>
-
- iiiinnnntttt aaaallllCCCCoooonnnnnnnneeeecccctttt((((iiiinnnntttt ssssoooouuuurrrrcccceeee,,,, iiiinnnntttt ddddeeeesssstttt,,,, AAAALLLLppppvvvv ****pppprrrrooooppppssss,,,, iiiinnnntttt nnnnpppprrrrooooppppssss))))
-
- PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRR
- _s_o_u_r_c_e is the source resource.
-
- _d_e_s_t is the destination resource.
-
- _p_r_o_p_s is a parameter/value list of desired properties for the
- connection (see aaaallllGGGGeeeettttPPPPaaaarrrraaaammmmssss((((3333ddddmmmm)))) for more information on
- parameter/value lists).
-
- _n_p_r_o_p_s is the number of parameter/value pairs in the list _p_r_o_p_s.
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- An audio _c_o_n_n_e_c_t_i_o_n moves audio data from one audio I/O resource to
- another. For example, when an application opens an audio input port, the
- audio system creates a connection from an input device to the input port.
- See aaaallllRRRReeeessssoooouuuurrrrcccceeeessss((((3333ddddmmmm)))) for information on resources in general.
-
- aaaallllCCCCoooonnnnnnnneeeecccctttt creates a connection from the resource _s_o_u_r_c_e to the resource
- _d_e_s_t. aaaallllCCCCoooonnnnnnnneeeecccctttt can connect a port to a device, a device to a port, or a
- device to a device; port-to-port connections are not supported at this
- time. Other types of resources cannot be connected.
-
- In addition, there are certain constraints on the directions of _s_o_u_r_c_e
- and _d_e_s_t. _s_o_u_r_c_e must be either an input device or an output port. _d_e_s_t
- must be either an output device or an input port.
-
- A connection performs certain operations on the audio data. These
- operations are given by the properties list _p_r_o_p_s. See below for the
- currently supported properties. If _n_p_r_o_p_s is 0, the connection will be
- given a default set of properties.
-
- If a connection already exists between the given _s_o_u_r_c_e and _d_e_s_t,
- aaaallllCCCCoooonnnnnnnneeeecccctttt will return the resource ID of the existing connection and set
- the given properties _p_r_o_p_s on that connection.
-
- Note that by default, connections persist after the application which
- creates them exits. In order to remove the connection, you must
- explicitly call aaaallllDDDDiiiissssccccoooonnnnnnnneeeecccctttt((((3333ddddmmmm)))), or create the connection with the
- AL_ASSOCIATE property.
-
- Only one property is currently supported for connections, AL_ASSOCIATE,
- which allows you to associate a connection with a particular port.
- AL_ASSOCIATE takes as its value the resource ID of a port (see
- aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeee((((3333ddddmmmm))))). When the port is destroyed, the connection is
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- aaaallllCCCCoooonnnnnnnneeeecccctttt((((3333ddddmmmm)))) aaaallllCCCCoooonnnnnnnneeeecccctttt((((3333ddddmmmm))))
-
-
-
- destroyed as well. This allows an application to create a connection
- which is guaranteed to go away when the application goes away.
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
- The following simple program takes two device names as command-line
- arguments and creates a connection between them. This connection will
- persist after the program exits.
-
- main(int argc, char **argv)
- {
- int fd;
- int src, dest;
- int id;
-
- if (argc != 3) {
- printf("usage: %s <src> <dest>\n",argv[0]);
- exit(-1);
- }
-
- /* Find the source resource */
- src = alGetResourceByName(AL_SYSTEM, argv[1], AL_DEVICE_TYPE);
- if (!src) {
- printf("invalid device %s\n", argv[1]);
- exit(-1);
- }
-
- /* Find the destination resource */
- dest = alGetResourceByName(AL_SYSTEM, argv[2], AL_DEVICE_TYPE);
- if (!dest) {
- printf("invalid device %s\n", argv[2]);
- exit(-1);
- }
-
- /* Attempt to connect them */
- if ((id = alConnect(src, dest, 0, 0))<0) {
- printf("connect failed: %s\n",alGetErrorString(oserror()));
- }
- printf("connection ID is %d\n",id);
- }
-
-
- The following code fragment creates a connection which goes away when a
- port goes away. Since the port is tied to the application, this
- connection does not persist after the application exits. This particular
- example creates a port which does not actually do audio; it is connected
- to no audio device. We also give it a minimal queue size so that it
- consumes few audio resources.
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- aaaallllCCCCoooonnnnnnnneeeecccctttt((((3333ddddmmmm)))) aaaallllCCCCoooonnnnnnnneeeecccctttt((((3333ddddmmmm))))
-
-
-
- ALport p;
- ALconfig c;
- ALpv pv;
- int id, src, dest;
-
- /* code here to set src & dest */
-
- [...]
-
- /* create a config structure */
- c = alNewConfig();
- if (!c) {
- printf("alNewConfig failed: %s0,alGetErrorString(oserror()));
- exit(-1);
- }
-
- /* set the config so the port does no audio */
- alSetDevice(c, AL_NULL_RESOURCE);
- alSetQueueSize(c, 100);
-
- /* now open a port using the config */
- p = alOpenPort("null port","r",c);
- if (!p) {
- printf("alOpenPort failed: %s0,alGetErrorString(oserror()));
- exit(-1);
- }
-
- /* Attempt to connect src & dest. We assume that these are set
- to valid resource IDs. */
-
- pv.param = AL_ASSOCIATE;
- pv.value.i = alGetResource(p);
-
- if ((id = alConnect(src, dest, &pv, 1))<0) {
- printf("connect failed: %s\n",alGetErrorString(oserror()));
- }
- printf("connection ID is %d\n",id);
-
- /* now, when we close the port, or the application exits (also
- closing the port), the connection will automatically go away */
- [...]
-
-
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- If successful, aaaallllCCCCoooonnnnnnnneeeecccctttt returns the resource ID of the connection. It
- returns -1 if the connection fails, and sets an error code which can be
- retrieved with oooosssseeeerrrrrrrroooorrrr((((3333CCCC)))).
-
- aaaallllCCCCoooonnnnnnnneeeecccctttt can fail for the following reasons:
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- aaaallllCCCCoooonnnnnnnneeeecccctttt((((3333ddddmmmm)))) aaaallllCCCCoooonnnnnnnneeeecccctttt((((3333ddddmmmm))))
-
-
-
- AAAALLLL____BBBBAAAADDDD____RRRREEEESSSSOOOOUUUURRRRCCCCEEEE
- _s_o_u_r_c_e or _d_e_s_t is an invalid resource.
-
- AAAALLLL____BBBBAAAADDDD____DDDDEEEEVVVVIIIICCCCEEEE____AAAACCCCCCCCEEEESSSSSSSS
- The audio system is not present or improperly configured.
-
- AAAALLLL____BBBBAAAADDDD____PPPPVVVVBBBBUUUUFFFFFFFFEEEERRRR
- _p_r_o_p_s is invalid and _n_p_r_o_p_s is nonzero.
-
- AAAALLLL____BBBBAAAADDDD____BBBBUUUUFFFFFFFFEEEERRRRLLLLEEEENNNNGGGGTTTTHHHH
- _n_p_r_o_p_s is less than zero.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- oserror(3C), alIntro(3dm), alGetParams(3dm), alDisconnect(3dm)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-